package com.numbfish.ch16_ex08_r2dbc_web_flux.repository;

import com.numbfish.ch16_ex08_r2dbc_web_flux.pojo.Book;
import com.numbfish.ch16_ex08_r2dbc_web_flux.pojo.Person;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Repository
public interface BookRepository extends R2dbcRepository<Book,Integer> {
    // 自定义 @Query SQL
    @Query("select b.*,p.name from book b left join person p on b.author_id = p.id  where b.id=?;")
    Mono<Book> findHaha(Integer id);
}
